package com.itheima.controller;

import com.itheima.entity.Result;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/setmeal")
public class SetmealController {

    @Autowired
    private SetmealService setmealService;


    //todo 查询套餐
    @GetMapping("/getAllSetmeal.do")
    public Result getAllSetmeal(){
        return setmealService.getAllSetmeal();

    }
    //todo 根据id查询套餐内容
    @PostMapping("/findById.do")
    public Result findById(Integer id){
        Setmeal setmeal = setmealService.getById(id);
        return new Result(true,"查询成功",setmeal);
    }
}
